package cn.lg.soar.database.base.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * 实体基类
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@ApiModel(value = "BaseEntity", description = "实体基类")
@Getter
@Setter
public abstract class BaseEntity implements IBaseEntity {

    private static final long serialVersionUID = -8774146775129382026L;
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @ApiModelProperty(value = "创建时间")
    @TableField(value = IBaseEntity.CREATE_TIME, fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    protected LocalDateTime createTime;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @ApiModelProperty(value = "更新时间")
    @TableField(value = IBaseEntity.UPDATE_TIME, fill = FieldFill.INSERT_UPDATE)
    protected LocalDateTime updateTime;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @TableField(value = IBaseEntity.CREATE_BY, fill = FieldFill.INSERT, updateStrategy = FieldStrategy.NEVER)
    @ApiModelProperty(value = "创建人")
    protected Long createBy;

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    @TableField(value = IBaseEntity.UPDATE_BY, fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty(value = "更新人")
    protected Long updateBy;

}
